﻿using Microsoft.AspNetCore.Mvc.Filters;
using SqlSugar;

namespace StoreIGet
{
    /// <summary>
    /// 全局异常过滤器
    /// </summary>
    public class GlobalExceptionFilter : IExceptionFilter
    {
        public readonly ILogger<GlobalExceptionFilter> _logger;
        public GlobalExceptionFilter(ILogger<GlobalExceptionFilter> logger)
        {
            _logger = logger;
        }
        public void OnException(ExceptionContext context)
        {
            _logger.LogError($"全局异常信息：{context.Exception.StackTrace}");
        }
    }
}
